using PKGames.Audio;
using System;
using UnityEngine;

namespace PKGames
{
	public class SpineAnimatorEventHandler : MonoBehaviour
	{
		public Action<string> OnSkinChange;

		private const int AUDIO_NAME_INDEX = 0;

		private const int AUDIO_VOLUME = 1;

		public void SkinChange(string skinName)
		{
			OnSkinChange.Fire(skinName);
		}

		public void PlayAudio(string audioRawData)
		{
			string[] array = audioRawData.Split('/');
			if (array.Length == 2)
			{
				MonoSingleton<AudioManager>.Instance.Play(array[0], loop: false, float.Parse(array[1]));
			}
		}

		public void StopAudio(string audioRawData)
		{
			MonoSingleton<AudioManager>.Instance.Stop(audioRawData);
		}
	}
}
